Skip to content

Conversation

frank-king
Copy link
Contributor

This PR adds a suggestion of constraining param for unary ops - and ! when the corresponding trait implementation
is missing.

Fixs #94543.

BTW, this is my first time to touch rustc, please correct me if I did anything wrong.

@rust-highfive
Copy link
Contributor

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 22, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2022
visitor.visit_ty(operand_ty);
if let [ty] = &visitor.0[..] {
if let ty::Param(p) = *operand_ty.kind() {
suggest_constraining_param(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I just followed what check_overloaded_binop does, I'm not sure if the passed arguments are right.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 22, 2022

📌 Commit f28d8b1 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 22, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#95188 ([`macro-metavar-expr`] Fix generated tokens hygiene)
 - rust-lang#95196 (rename LocalState::Uninitialized to Unallocated)
 - rust-lang#95197 (Suggest constraining param for unary ops when missing trait impl)
 - rust-lang#95200 (Cancel a not emitted error after parsing const generic args)
 - rust-lang#95207 (update Termination trait docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0e80a7a into rust-lang:master Mar 22, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants